#include <iostream>
using namespace std;
int main()
{
	int t, n;
	char ch;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		cin >> ch;
		cin >> n;
		if (ch == 'C') {
		char *arr=new char[n];
			for (int j = 0; j < n; j++)
			{
				cin >> arr[j];
			}
			char max = arr[0];
			char* p = &max;
			for (int j = 0; j < n; j++)
			{
				if (arr[j] > *p)
					max = arr[j];
			}
			cout << max<<endl;
			delete[]arr;
		}
		else if (ch == 'I')
		{	
		int *arr=new int[n];
		int *p=arr; 
			for (int j = 0; j < n; j++)
			{
				cin >> arr[j] ;
			}
			int sum=0;
			for (int j = 0; j < n; j++)
			{
					sum=sum+*p;
					p++;
			}
			double av=sum*1.0/n;	
			cout << av<<endl;
				delete[]arr;
		}
		else if(ch=='F') 
		{
			float*arr=new float[n];
			for (int j = 0; j < n; j++)
			{
				cin >>arr[j] ;
			}
		float min = arr[0];
			float* p = &min;
			for (int j = 0; j < n; j++)
			{
				if (arr[j] < *p)
					min = arr[j];
			}
			cout << min<<endl;
				delete[]arr;
		}
	}
	return 0;
}
